#include <iostream>
using namespace std;
const int N = 10;
int arr[N];
using ll = long long;
int main()
{
    string s = "2022";
    for (int i = 0; i < s.length(); i++)
    {
        arr[i + 1] = s[i] - '0';
    }
    ll x = 0;
    for (int i = 1; i <= s.length(); i++)
    {
        x = x * 9 + arr[i];
    }
    cout << x << endl;
    return 0;
}